home *** CD-ROM | disk | FTP | other *** search
- property pAppFolder, pDesktop, pInstallPath, pPathSep, pSourceFolder, pSourceFileList, pCopiedFileList
-
- on new me
- if the platform contains "Mac" then
- baMsgBox("This software is for PC only", "Install ISS Simulator V3.0", "OK", "stop", 1)
- halt()
- else
- me.pPathSep = "\"
- me.pAppFolder = baSysFolder("program files")
- me.pSourceFolder = the moviePath & "ISSsimulator_V3.0\"
- end if
- me.pDesktop = baSysFolder("desktop")
- me.pInstallPath = me.pAppFolder & "ISSsimulator_V3.0" & pPathSep
- me.pSourceFileList = baFileList(me.pSourceFolder, "*.*")
- me.pCopiedFileList = []
- return me
- end
-
- on confirmInstallation me
- confirmed = 0
- dialogResult = confirmInstallationDialog()
- if dialogResult[2] = "Continue" then
- confirmed = 1
- end if
- return confirmed
- end
-
- on getInstallPath me
- dialogResult = getInstallPathDialog(VOID, VOID, VOID, VOID, VOID, [#installPathField: me.pInstallPath], VOID, VOID, VOID)
- case dialogResult[2] of
- "Browse":
- newPath = baGetFolder(me.pInstallPath, "Select installation folder", 2, EMPTY, -2, -2)
- if newPath <> EMPTY then
- if confirmValidPath(me, newPath) then
- me.pInstallPath = newPath
- end if
- end if
- getInstallPath(me)
- "Continue":
- me.pInstallPath = dialogResult[3][#installPathField]
- if confirmValidPath(me, me.pInstallPath) then
- if (me.pInstallPath = me.pAppFolder) or (me.pInstallPath = me.pDesktop) then
- me.pInstallPath = me.pInstallPath & "ISS Simulator V3.0"
- end if
- if not baFolderExists(me.pInstallPath) then
- baCreateFolder(me.pInstallPath)
- end if
- else
- baMsgBox("You entered an invalid installation path. Please try again", "Install ISS Simulator V3.0", "OK", "exclamation", 1)
- getInstallPath(me)
- end if
- "Exit":
- halt()
- end case
- end
-
- on confirmValidPath me, aPath
- lastDelimiter = the itemDelimiter
- pathIsValid = 1
- the itemDelimiter = me.pPathSep
- if baDiskList().getOne(aPath.item[1] & me.pPathSep) = 0 then
- pathIsValid = 0
- end if
- the itemDelimiter = lastDelimiter
- return pathIsValid
- end
-
- on installFiles me
- cursor(4)
- installResult = 1
- if me.pSourceFileList.count > 0 then
- repeat with i = 1 to me.pSourceFileList.count
- thisSource = me.pSourceFolder & me.pSourceFileList[i]
- thisDest = me.pInstallPath & me.pSourceFileList[i]
- copyResult = baCopyFile(thisSource, thisDest, "always")
- if copyResult = 0 then
- if me.pCopiedFileList.getOne(me.pSourceFileList[i]) = 0 then
- me.pCopiedFileList.add(me.pSourceFileList[i])
- end if
- next repeat
- end if
- installResult = 0
- end repeat
- else
- installResult = 0
- end if
- cursor(-1)
- return installResult
- end
-
- on undoInstallation me
- cursor(4)
- if me.pCopiedFileList.count > 0 then
- repeat with i = 1 to me.pCopiedFileList.count
- baDeleteFile(me.pInstallPath & me.pCopiedFileList[i])
- end repeat
- me.pCopiedFileList = []
- end if
- cursor(-1)
- end
-
- on makeShortcut me
- baMakeShortcut(me.pInstallPath & "iss_main.htm", me.pDesktop, "ISS Simulator V3.0")
- end
-